import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

const router = new Router({
    routes: [{
            path: "*",
            redirect: "/"
        },
        {
            path: "/",
            component: resolve => require(["@/views/index/index.vue"], resolve),
            meta: { title: "首页" }
        },
        {
            path: "/index",
            component: resolve => require(["@/views/home/index.vue"], resolve),
            meta: { title: "" },
            redirect: "/check",
            children: [{
                    path: "check",
                    component: resolve => require(["@/views/Check/index.vue"], resolve),
                    meta: { title: "网通查" }
                },
                {
                    path: "declare",
                    component: resolve => require(["@/views/Declare/index.vue"], resolve),
                    meta: { title: "网申报" }
                },
                {
                    path: "transact",
                    component: resolve =>
                        require(["@/views/Transact/index.vue"], resolve),
                    meta: { title: "网通办" }
                },
                {
                    path: "mall",
                    component: resolve => require(["@/views/Mall/index.vue"], resolve),
                    meta: { title: "优惠购" }
                },
                {
                    path: "forum",
                    component: resolve => require(["@/views/Forum/index.vue"], resolve),
                    meta: { title: "优惠购" }
                },
                {
                    path: "zccx",
                    component: resolve => require(["@/views/ZCCX/index.vue"], resolve),
                    meta: { title: "政策查询" }
                },
                {
                    path: "zcpp",
                    component: resolve => require(["@/views/ZCPP/index.vue"], resolve),
                    meta: { title: "政策匹配" }
                },
                {
                    path: "fwk",
                    component: resolve => require(["@/views/FWK/index.vue"], resolve),
                    meta: { title: "服务卡" }
                },
                {
                    path: "des",
                    component: resolve => require(["@/views/DES/index.vue"], resolve),
                    meta: { title: "详情页" }
                }
            ]
        }
    ]
});

export default router;